Skip to content

feat(recall): measurable paraphrase corpus, softer precision floor, SE synonyms - #168

Merged
navbytes merged 2 commits into
mainfrom
claude/recall-ranking
Jul 28, 2026
Merged

navbytes merged 2 commits into
mainfrom
claude/recall-ranking

Conversation

@navbytes

Copy link
Copy Markdown
Owner

Tier 3 of the field-test backlog — the ranking work.

The measurement comes first

A field test measured HIT@1 falling from 65% → 41% on a fixed query set purely as the store grew 20 → 30 notes. Nothing would have caught that: recall_precision_test.go uses 2–3 note corpora, where the failure modes that matter can't appear — a long note winning on coincidental overlap, or a glossary note acting as a universal attractor.

So the first change here is the measurement, not a scoring tweak:

  • 12 notes — 8 targets plus plausible distractors, including a deliberate glossary note that enumerates everyone else's vocabulary
  • 8 queries, each sharing no verbatim content word with its target
  • An asserted minHitAtOne floor, with a comment saying to raise it on a genuine improvement and never lower it to make a change pass
  • A companion test asserting the glossary note never takes build(deps): bump the actions group across 1 directory with 5 updates #1

It found a real defect immediately. It's also what makes the deferred length-normalization work evaluable instead of a guess — I deliberately did not attempt that here, because without this corpus there was no way to tell whether it helped or hurt.

The precision floor was a cliff in both directions

Requiring ≥2 matched concepts for any query of ≥4 words is right when something clears it. As an unconditional filter it returned nothing for a heavily paraphrased query sharing one concept with its target — while the same intent in three words returned the right note. Three of the eight corpus queries failed exactly that way, returning (nothing).

The floor now applies only when at least one candidate clears it. Otherwise one shared concept is all the signal the query carries, and a ranked list beats an empty answer — the score already tells the caller how weak the match is.

HIT@1: 5/8 → 8/8.

Every existing guarantee still holds — TestRankPrecisionFloor, TestRankDropsNoise and TestRankNoCrossDomainBleed pass unchanged.

gc left the memory-leak group

nt gc is store cleanup, so "what does gc do" surfaced a heap-allocation note above the nt gc reference. It belongs in the list of ambiguous cross-domain tokens this file already deliberately refuses to group (column, index, origin, lock, database) — so this follows the existing rule rather than inventing one.

Eight software-engineering groups added

The table was generic web-SaaS vocabulary (billing, i18n, cors, stripe) for a tool whose users are mostly writing code. A field test of 48 natural paraphrase pairs from a Go codebase linked 3.

Added: undo/revert/rollback, lint/vet/staticcheck, duplicate/clobber/overwrite, regex/matcher, serialize/marshal/encode, dependency/bump/upgrade, ci/pipeline, frontmatter/yaml/toml.

Narrow and non-overlapping per this file's own rule. flag/option and module/package are deliberately absent — a feature flag and a CLI flag are not the same thing.

SKILL.md's recovery advice was backwards

It said an empty result means nothing is recorded, "don't retry with looser words." The corpus shows the right move for a long, specific query is one shorter retry — a wordy question dilutes the two or three concepts carrying the meaning. Reworded to say shorter, not looser.

Verification

go build, go vet ./..., go test ./..., golangci-lint run (0 issues) all clean.


Generated by Claude Code

claude added 2 commits July 28, 2026 14:52
…E synonyms

Tier 3 of the field-test backlog. A field test measured HIT@1 falling from 65%
to 41% on a fixed query set purely as the store grew 20 -> 30 notes. Nothing
would have caught that: recall_precision_test.go uses 2-3 note corpora, where
the failure modes that matter can't appear.

So the first change is the measurement, not a scoring tweak. The new corpus is
12 notes (8 targets plus plausible distractors, including a glossary note —
a known universal attractor because it enumerates everyone else's vocabulary)
and 8 queries that share NO verbatim content word with their target, with a
HIT@1 floor asserted. It found a real defect immediately, and it is the thing
that makes the deferred length-normalization work evaluable rather than a
guess.

**The precision floor was a cliff in both directions.** Requiring >=2 matched
concepts for any query of >=4 words is right when something clears it, but as
an unconditional filter it returned NOTHING for a heavily paraphrased query
that shares one concept with its target — while the same intent in three words
returned the right note. Three of the eight corpus queries failed exactly that
way. The floor now applies only when at least one candidate clears it;
otherwise one shared concept is all the signal the query carries, and a ranked
list beats an empty answer (the score already shows how weak the match is).

HIT@1 on the corpus: 5/8 -> 8/8. Every existing guarantee still holds —
TestRankPrecisionFloor, TestRankDropsNoise and TestRankNoCrossDomainBleed all
pass unchanged.

**`gc` left the memory-leak synonym group.** `nt gc` is store cleanup, so
"what does gc do" surfaced a heap-allocation note above the gc reference. It
belongs in the list of ambiguous cross-domain tokens this file already
deliberately refuses to group (column, index, origin, lock, database).

**Eight software-engineering groups added.** The table was generic web-SaaS
vocabulary (billing, i18n, cors) for a tool whose users are mostly writing
code; 48 natural paraphrase pairs from a Go codebase linked only 3. Added
undo/revert/rollback, lint/vet/staticcheck, duplicate/clobber/overwrite,
regex/matcher, serialize/marshal/encode, dependency/bump/upgrade, ci/pipeline,
frontmatter/yaml/toml — narrow and non-overlapping per this file's own rule.
flag/option and module/package are deliberately absent: a feature flag and a
CLI flag are not the same thing.

**SKILL.md's recovery advice was backwards.** It said an empty result means
nothing is recorded, "don't retry with looser words". The corpus shows the
right move for a long, specific query is one SHORTER retry — a wordy question
dilutes the two or three concepts carrying the meaning.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgqQf7Lvou5F5as9aNmagu
@navbytes
navbytes marked this pull request as ready for review July 28, 2026 14:59
@navbytes
navbytes merged commit 317f18b into main Jul 28, 2026
9 checks passed
@navbytes
navbytes deleted the claude/recall-ranking branch July 28, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants